import 'package:oramemo/generated/json/base/json_convert_content.dart';
import 'package:oramemo/entity/conversation_list_entity.dart';

ConversationListEntity $ConversationListEntityFromJson(
    Map<String, dynamic> json) {
  final ConversationListEntity conversationListEntity = ConversationListEntity();
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    conversationListEntity.total = total;
  }
  final List<ConversationListRows>? rows = (json['rows'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<ConversationListRows>(e) as ConversationListRows)
      .toList();
  if (rows != null) {
    conversationListEntity.rows = rows;
  }
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    conversationListEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    conversationListEntity.msg = msg;
  }
  return conversationListEntity;
}

Map<String, dynamic> $ConversationListEntityToJson(
    ConversationListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['total'] = entity.total;
  data['rows'] = entity.rows?.map((v) => v.toJson()).toList();
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  return data;
}

extension ConversationListEntityExtension on ConversationListEntity {
  ConversationListEntity copyWith({
    int? total,
    List<ConversationListRows>? rows,
    int? code,
    String? msg,
  }) {
    return ConversationListEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows
      ..code = code ?? this.code
      ..msg = msg ?? this.msg;
  }
}

ConversationListRows $ConversationListRowsFromJson(Map<String, dynamic> json) {
  final ConversationListRows conversationListRows = ConversationListRows();
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    conversationListRows.createTime = createTime;
  }
  final ConversationListRowsParams? params = jsonConvert.convert<
      ConversationListRowsParams>(json['params']);
  if (params != null) {
    conversationListRows.params = params;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    conversationListRows.id = id;
  }
  final int? deviceId = jsonConvert.convert<int>(json['deviceId']);
  if (deviceId != null) {
    conversationListRows.deviceId = deviceId;
  }
  final int? conversationType = jsonConvert.convert<int>(
      json['conversationType']);
  if (conversationType != null) {
    conversationListRows.conversationType = conversationType;
  }
  final String? inPhone = jsonConvert.convert<String>(json['inPhone']);
  if (inPhone != null) {
    conversationListRows.inPhone = inPhone;
  }
  final String? outPhone = jsonConvert.convert<String>(json['outPhone']);
  if (outPhone != null) {
    conversationListRows.outPhone = outPhone;
  }
  final String? hangupTime = jsonConvert.convert<String>(json['hangupTime']);
  if (hangupTime != null) {
    conversationListRows.hangupTime = hangupTime;
  }
  final String? firstWord = jsonConvert.convert<String>(json['firstWord']);
  if (firstWord != null) {
    conversationListRows.firstWord = firstWord;
  }
  final int? callDuration = jsonConvert.convert<int>(json['callDuration']);
  if (callDuration != null) {
    conversationListRows.callDuration = callDuration;
  }
  final int? voiceRecordId = jsonConvert.convert<int>(json['voiceRecordId']);
  if (voiceRecordId != null) {
    conversationListRows.voiceRecordId = voiceRecordId;
  }
  return conversationListRows;
}

Map<String, dynamic> $ConversationListRowsToJson(ConversationListRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createTime'] = entity.createTime;
  data['params'] = entity.params?.toJson();
  data['id'] = entity.id;
  data['deviceId'] = entity.deviceId;
  data['conversationType'] = entity.conversationType;
  data['inPhone'] = entity.inPhone;
  data['outPhone'] = entity.outPhone;
  data['hangupTime'] = entity.hangupTime;
  data['firstWord'] = entity.firstWord;
  data['callDuration'] = entity.callDuration;
  data['voiceRecordId'] = entity.voiceRecordId;
  return data;
}

extension ConversationListRowsExtension on ConversationListRows {
  ConversationListRows copyWith({
    String? createTime,
    ConversationListRowsParams? params,
    int? id,
    int? deviceId,
    int? conversationType,
    String? inPhone,
    String? outPhone,
    String? hangupTime,
    String? firstWord,
    int? callDuration,
    int? voiceRecordId,
  }) {
    return ConversationListRows()
      ..createTime = createTime ?? this.createTime
      ..params = params ?? this.params
      ..id = id ?? this.id
      ..deviceId = deviceId ?? this.deviceId
      ..conversationType = conversationType ?? this.conversationType
      ..inPhone = inPhone ?? this.inPhone
      ..outPhone = outPhone ?? this.outPhone
      ..hangupTime = hangupTime ?? this.hangupTime
      ..firstWord = firstWord ?? this.firstWord
      ..callDuration = callDuration ?? this.callDuration
      ..voiceRecordId = voiceRecordId ?? this.voiceRecordId;
  }
}

ConversationListRowsParams $ConversationListRowsParamsFromJson(
    Map<String, dynamic> json) {
  final ConversationListRowsParams conversationListRowsParams = ConversationListRowsParams();
  return conversationListRowsParams;
}

Map<String, dynamic> $ConversationListRowsParamsToJson(
    ConversationListRowsParams entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  return data;
}

extension ConversationListRowsParamsExtension on ConversationListRowsParams {
}